<?xml version="1.0" encoding="iso-8859-1"?>

<xsl:stylesheet version="1.0" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns:ef="http://www.enginframe.com/2000/EnginFrame"
                exclude-result-prefixes="ef">

<!--
 * Copyright 1998-2010 by Nice, srl.,
 * Via Serra 33, Camerano Casasco, Asti, 14020, Italy
 * All rights reserved.
 *
 * This software is the confidential and proprietary information
 * of Nice, srl. ("Confidential Information").  You
 * shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement
 * you entered into with Nice.
-->

<!--
 * layout.xsl
 * EnginFrame @VERSION@ default layout
-->


  <xsl:output
    encoding="utf-8"
    method="html"
    media-type="text/html"
    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
    doctype-system="http://www.w3.org/TR/html4/loose.dtd"
    omit-xml-declaration="yes"
  />


  <!-- System stylesheets inclusions -->
  <xsl:include href="$(EF_ROOT)/lib/xsl/com.enginframe.system.xsl" />
  <xsl:include href="$(EF_ROOT)/lib/xsl/com.enginframe.multi.xsl" />

  <!-- Default layout templates inclusion -->
  <xsl:include href="$(EF_ROOT)/plugins/ef_layout/lib/xsl/layout_templates.xsl" />


  <!-- Custom parameters -->

  <!-- images and css directories locations -->
  <xsl:variable name="img">/<xsl:value-of select="$_root_context"/>/ef_layout/images</xsl:variable>
  <xsl:variable name="css">/<xsl:value-of select="$_root_context"/>/ef_layout/css</xsl:variable>
  <xsl:variable name="css-irods">/<xsl:value-of select="$_root_context"/>/irods/css</xsl:variable>
  <xsl:variable name="js">/<xsl:value-of select="$_root_context"/>/irods/js</xsl:variable>

  <!-- irods custom var -->
  <xsl:variable name="LOGGED_USER" select="//ef:profile/ef:login-name/."/>
  <xsl:variable name="IRODS_ZONE" select="//ef:session-list/ef:session[@id='irodsZone']"/>
  <xsl:variable name="IRODS_RES" select="//ef:session-list/ef:session[@id='irodsDefResource']"/>
  <xsl:variable name="IRODS_SERVER" select="//ef:session-list/ef:session[@id='irodsHost']"/>
  <xsl:variable name="IRODS_PORT" select="//ef:session-list/ef:session[@id='irodsPort']"/>
  <xsl:variable name="my_resource" select="//ef:session-list/ef:session[@id='my_resource']"/>


  <!-- Navigation menu width -->
  <xsl:variable name="navigation_width">200px</xsl:variable>

  <!-- Enable tree rendering for navigation menu -->
  <xsl:variable name="ef.navigation">treeview</xsl:variable>
  <!-- Enable file actions (tgz, zip, tar, delete...) in spooler view -->
  <xsl:variable name="file_actions">1</xsl:variable>
  <!-- Enable file upload in spooler view -->
  <xsl:variable name="upload_file">1</xsl:variable>
  <!-- Enable file streaming download in spooler view -->
  <xsl:variable name="streaming_download">1</xsl:variable>

  <!-- root template match -->
  <xsl:template match="/" mode="html">
    <html>
      <head>
        <xsl:call-template name="header_rendering"/>
        <link type="text/css" rel="StyleSheet" href="{$css-irods}/irods.css" />
        <script src="{$js}/dropdown.js" type="text/javascript"></script>
      </head>
      <body>
        <div id="container">
          <xsl:call-template name="banner_rendering_irods"/>
          <xsl:call-template name="contents_rendering"/>
          <xsl:call-template name="footer_rendering"/>
        </div>
      </body>
    </html>
  </xsl:template>

  <xsl:template name="banner_rendering_irods" >
    <script type="text/javascript">
    $(document).ready(function() {
      var my_res='<xsl:value-of select="$my_resource"/>';
      var tokens = my_res.split(":");
      var output = "";
      for (i = 0; i &lt; tokens.length; i++) {
        //output += "&lt;li&gt;&lt;a href=\"#\"&gt;"+tokens[i]+"&lt;/a&gt;&lt;/li&gt;";
        output += "&lt;li&gt;&lt;a href=\"irods.xml?_uri=//com.enginframe.irods/irods.change.res&amp;irods_res="+tokens[i]+"\"&gt;"+tokens[i]+"&lt;/a&gt;&lt;/li&gt;";
      }
      $("#irodsRes").html(output);
    });
    </script>

    <div id="ef_banner">
      <div id="ef_banner_logo" />
      <div id="ef_banner_actions" >
        <xsl:choose>
          <xsl:when test="$LOGGED_USER != ''">
            <div id="ef_banner_actions_welcome">
              <span id="user"><xsl:value-of select="$LOGGED_USER"/></span>
              <xsl:if test="$IRODS_SERVER != ''">
                 <span id="hostname"><xsl:value-of select="$IRODS_SERVER"/>:<xsl:value-of select="$IRODS_PORT"/></span>
              </xsl:if>
              <xsl:if test="$IRODS_ZONE != ''">
                 <span id="zone"><xsl:value-of select="$IRODS_ZONE"/></span>
              </xsl:if>
              <xsl:choose>
                <xsl:when test="$IRODS_RES != ''">
                  <span id="res2">
                    <li id="menu1" class="menu">
                      <xsl:value-of select="$IRODS_RES"/>
                      <ul id="irodsRes" class="submenu"></ul>
                    </li>
                  </span>
                </xsl:when>
                <xsl:otherwise>
                  <span id="res">  
                    <ul>
                      <li id="menu1" class="menu">
                        Click Here to choose the Default Resources
                        <ul id="irodsRes" class="submenu"></ul>
                      </li>
                    </ul>
                  </span>
                </xsl:otherwise>
              </xsl:choose>
            </div>
          </xsl:when>
          <xsl:otherwise>
            <div id="ef_banner_actions_links">
              <a href="http://www.enginframe.com/demo">Online demo</a>
            </div>
            <div id="ef_banner_actions_links">
              <a href="http://www.enginframe.com">EnginFrame</a>
            </div>
            <div id="ef_banner_actions_links">
              <a href="http://www.nice-software.com">NICE</a>
            </div>
          </xsl:otherwise>
        </xsl:choose>
      </div>
    </div>
  </xsl:template>


</xsl:stylesheet>



